Other Constants

The following constants are available globally.

  • An NSNumber object containing a floating-point number that specifies the width and height (measured in points) at which the map displays each raster image tile when the map’s zoom level is an integer. The raster source scales its images up or down when the map’s zoom level falls between two integers.

    The default value for this option is 512. Version 4 of the Mapbox Maps API requires a value of 256, as do many third-party tile servers, so consult your provider’s documentation for the correct value.

    This option is only applicable to MGLRasterSource objects; it is ignored when initializing MGLVectorSource objects.

    Declaration

    Objective-C

    extern const MGLTileSourceOption _Nonnull MGLTileSourceOptionTileSize

    Swift

    static let tileSize: MGLTileSourceOption
  • A version number identifying the default version of the Mapbox Streets style obtained through the -streetsStyleURL method. This version number may also be passed into the -streetsStyleURLWithVersion: method.

    The value of this constant generally corresponds to the latest released version as of the date on which this SDK was published. You can use this constant to ascertain the style used by MGLMapView and MGLTilePyramidOfflineRegion when no style URL is specified. Consult the Mapbox Styles API documentation for the most up-to-date style versioning information.

    Warning

    The value of this constant may change in a future release of the SDK. If you use any feature that depends on a specific aspect of a default style – for instance, the minimum zoom level that includes roads – you may use the current value of this constant or the underlying style URL, but do not use the constant itself. Such details may change significantly from version to version.

    Declaration

    Objective-C

    static const NSInteger MGLStyleDefaultVersion = 10

    Swift

    let MGLStyleDefaultVersion: Int
  • An NSNumber object containing an integer that determines the style function’s exponential interpolation base.

    The exponential interpolation base controls the rate at which the function’s output values increase. A value of 1 causes the function to increase linearly based on zoom level or attribute value. A higher exponential interpolation base causes the function’s output values to vary exponentially, increasing more rapidly towards the high end of the function’s range. The default value of this property is 1, for a linear curve.

    This attribute corresponds to the base function property in the Mapbox Style Specification.

    This option only applies to functions that use an MGLInterpolationModeExponential interpolation mode that are assigned to interpolatable style layer properties.

    Declaration

    Objective-C

    extern const MGLStyleFunctionOption _Nonnull MGLStyleFunctionOptionInterpolationBase

    Swift

    static let interpolationBase: MGLStyleFunctionOption
  • An MGLConstantStyleValue object that specifies a default value that a style function can use when it can’t otherwise determine a value.

    A default value can be used to set the value of a style layer property that is not otherwise set by a function. For example, a source function with a MGLInterpolationModeCategorical interpolation mode with stops that specify color values to use based on a feature’s attributes would set any feature that does not have attributes that match the stop key values to this default value.

    This option only applies to MGLSourceStyleFunction and MGLCompositeStyleFunction functions.

    Declaration

    Objective-C

    extern const MGLStyleFunctionOption _Nonnull MGLStyleFunctionOptionDefaultValue

    Swift

    static let defaultValue: MGLStyleFunctionOption
  • Indicates an error occurred in the Mapbox SDK.

    Declaration

    Objective-C

    extern const NSErrorDomain _Nonnull MGLErrorDomain

    Swift

    let MGLErrorDomain: String